<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./OL_SDK/include-openlayers-local.js"></script>
    <script src="./libs/gaode.js"></script>
</head>

<body>
    <div id="map">
    </div>
    <script>
        var map = new ol.Map({
            target: "map",
            layers: [gaode],
            view: new ol.View({
                projection: 'EPSG:4326',
                center: [114.30, 30.50],
                zoom: 4
            })
        })
        /* 1、创建一个多边形 */
        const polygon = new ol.Feature({
            geometry: new ol.geom.Polygon([
                [
                    [100, 10],
                    [105, 25],
                    [110, 15]
                ]
            ])
        })
        /* 2、设置去样式信息 */
        //设置区样式信息
        const style = new ol.style.Style({
            //填充色
            fill: new ol.style.Fill({
                color: 'rgba(255, 0, 255, 0.9)',
            }),
            //边线颜色
            stroke: new ol.style.Stroke({
                color: '#ffcc33',
                width: 10,
            })
        })
        polygon.setStyle(style)
        /* 3、设置数据源 */
        var source = new ol.source.Vector({
            features: [polygon],
            wrapX: false //x轴不重复
        })
        /* 4、创建图层 */
        var vector = new ol.layer.Vector({
            source: source
        })
        /* 5、将图层添加到地图容器中 */
        map.addLayer(vector)
    </script>
</body>

</html>